package com.slz3.business.module.goodsManagement.gooAttributeValue.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooAttributeValue.domain.GooAttributeValue;
import com.slz3.business.module.goodsManagement.gooAttributeValue.domain.GooAttributeValueFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooAttributeValueTransactionalServiceImpl implements GooAttributeValueTransactionalService {

    @Override
    public GooAttributeValue modify(GooAttributeValue gooAttributeValueNew) {
        Repositorys.gooAttributeValue.test();
        Repositorys.gooAttributeValue.save(GooAttributeValueFactory.initBaseFields());
        System.err.println(1 / 0);
        gooAttributeValueNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooAttributeValue.saveAndFlush(gooAttributeValueNew);
    }

    @Override
    public List<GooAttributeValue> batchModify(List<GooAttributeValue> gooAttributeValueList) {
        return Repositorys.gooAttributeValue.saveAll(gooAttributeValueList);
    }
}
